type popArr1 = ['a', 'b', 'c', 'd']
type popArr2 = [3, 2, 1]

type rePop1 = Pop<popArr1> // expected to be ['a', 'b', 'c']
type rePop2 = Pop<popArr2> // expected to be [3, 2]

type Pop<T> = T extends [...infer R, unknown] ? R : never;

type rePush1 = Push<popArr1, 'e'> // expected to be ['a', 'b', 'c', 'd', 'e']
type rePush2 = Push<popArr2, '0'> // expected to be [3, 2, 1, '0']
type Push<T, P> = T extends [...infer R] ? [...R, P] : never;

type reShift1 = Shift<popArr1> // expected to be ['b', 'c', 'd']
type reShift2 = Shift<popArr2> // expected to be [2, 1]
type Shift<T> = T extends [unknown, ...infer R] ? R : never;